

import { Column, CreateDateColumn, Entity, JoinTable, ManyToMany, PrimaryGeneratedColumn, UpdateDateColumn } from 'typeorm';
import { Role } from './role.entity';

@Entity()
export class User {
  @PrimaryGeneratedColumn()
  id: number;

  @Column({
    length:50
  })
  username: string;

  @Column({
    length:50
  })
  password: string;

  @CreateDateColumn()
  createTime: Date;
  
  @UpdateDateColumn()
  updateTime: Date;

  @ManyToMany(() => Role)
  @JoinTable({
    name:'user_role_relation'
  })
  roles: Role[];


}
